package com.suxin.test.netty.adv.server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import lombok.extern.slf4j.Slf4j;
import org.example.netty.adv.vo.KryoSerializer;

import java.util.List;

/**
 * @Author: tang
 * @Description: 业务解码器
 * @Date 2025/1/21 13:54
 */
@Slf4j
public class KryoDecoder extends ByteToMessageDecoder {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        Object obj = KryoSerializer.deserialize(in);
        out.add(obj);
    }
}
